import org.omg.SendingContext.RunTime;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;

class MyCompare implements Comparator<Integer> {


    @Override
    public int compare(Integer o1, Integer o2) {
        return  o2-o1;
    }
}
public class TestFive  {




    public static void main(String[] args) {
        ThreadLocal<Integer> threadLocal = new ThreadLocal<>();
        threadLocal.set(1);


        PriorityQueue<Integer> queue = new PriorityQueue<>(new MyCompare());
        PriorityQueue<Integer> queue1 = new PriorityQueue<>((a,b)->{
            return b-a;
        });
        ConcurrentHashMap<Integer,Integer> concurrentHashMap = new ConcurrentHashMap<>();
        concurrentHashMap.put(1,1);
        Hashtable<Integer,Integer> hashtable = new Hashtable<>();
        hashtable.put(1,1);
        CopyOnWriteArrayList<Integer> copyOnWriteArrayList = new CopyOnWriteArrayList<>();
        List<Integer> list = new LinkedList<>();
        Collections.synchronizedList(list);
        Runtime.getRuntime().totalMemory();
        copyOnWriteArrayList.add(1);
        queue.add(1);
        queue.add(2);
        System.out.println(queue.peek());
        queue1.add(1);
        queue1.add(2);
        System.out.println(queue1.peek());
    }
    public static void main5(String[] args) throws FileNotFoundException {

        Integer a = 10;
        Integer b= 10;
        if(a==b){
            System.out.println("11");
        }
             a=128;
        b=128;
        if(a==b){
            System.out.println("22");
        }
        List<Integer> list = new LinkedList<>();

    }
    public static void main3(String[] args) {

        System.out.println("kaihs");
            try
            {
                System.out.println("222");
                System.out.println("12311");
               return;
            }
            catch (Exception e)
            {
            }
            finally
            {
                System.out.println("123");
            }
        }

    public static void main2(String[] args) {
       int a = 1;
        switch (a){
            case 1:
                System.out.println("good");
                break;
            case  2:
                System.out.println("nice");break;
            default:
                System.out.println("jieshu");break;
        }

    }

    public static void main1(String sgf[]) {
        StringBuffer a=new StringBuffer("A");
        StringBuffer b=new StringBuffer("B");
        operate(a,b);
        System.out.println(a+"."+b);
    }
    static void operate(StringBuffer x,StringBuffer y) {
        x.append(y);
        y=x;
    }
}
